
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>

<html>
<head>
    <title>Title</title>
</head>
<body>
<table border="1">
    <tr>
        <td>id</td>
        <td>title</td>
        <td>publishTime</td>
    </tr>
    <c:forEach begin="1" end="${newslist.size()}" var="i">
        <c:if test="${i%2==1}">
            <tr style="background-color: gray">
                <td><c:out value=" ${newslist[i-1].getId() }"/></td>
                <td><c:out value=" ${newslist[i-1].getTitle() }"/></td>
                <td><c:out value=" ${newslist[i-1].getPublishTime() }"/></td>
            </tr>
        </c:if>
        <c:if test="${i%2==0}">
            <tr>
                <td><c:out value=" ${newslist[i-1].getId() }"/></td>
                <td><c:out value=" ${newslist[i-1].getTitle() }"/></td>
                <td><c:out value=" ${newslist[i-1].getPublishTime() }"/></td>
            </tr>
        </c:if>
    </c:forEach>
</table>
</body>
</html>
